export default {
  computed: {

    lunboheight() {
      return this.px2rem(this.option.lunboheight || 88)
    },
    spacingTop() {
      return this.px2rem(this.option.spacingTop || 0)
    },

    indicators() {
      return this.option.indicators
    },
    link() {
      return this.option.link
    },
    moreLink() {
      return this.option.moreLink
    },
    showNumber() {
      return this.option.showNumber
    },
    showSubtitle() {
      return this.option.showSubtitle
    },
    spacingTopB() {
      return this.px2rem(this.option.spacingTopB || 0)
    },
    spacingBottom() {
      return this.px2rem(this.option.spacingBottom || 0)
    },
    // 图片高度
    imgHeight() {
      return this.px2rem(this.option.imgHeight || 340)
    },
    // 是否自动播放
    isAutoPlay() {
      return this.option.isAutoPlay
    },
    // 自动轮播时长
    delayTime() {
      return this.option.delayTime > 0 ? this.option.delayTime * 1000 : 5000
    },

    // 是否循环
    loop() {
      return this.option.loop
    }
  },
  methods: {
    toMore(path) {
      if (this.moreLink.link) {
        if (this.moreLink.link.startsWith('http')) {
          window.location.href = this.moreLink.link
        } else {
          this.$router.push({ path: this.moreLink.link })
        }
      }
    },
    /**
     * 文字裁剪
     */
    clampText() {
      this.$nextTick(() => {
        const clampDom = document.querySelectorAll('.clamp2')
        clampDom.forEach(item => {
          $clamp(item, { clamp: 2 })
        })
      })
    }
  }
}
